﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Extjs_ReGSharp.Criteria
{
	internal class CompareToCriteria<T> : BaseCriteria<T, string>
	{
		private StringComparison m_StringComparison;

		public CompareToCriteria(string field, string value)
			: this(field, value, StringComparison.OrdinalIgnoreCase)
		{

		}

		public CompareToCriteria(string field, string value, StringComparison comparison)
			: base(field, value)
		{
			m_StringComparison = comparison;
		}

		protected override bool IsValid(string instanceValue)
		{
			return string.Compare(instanceValue, CriteriaValue, m_StringComparison) == 0;
		}
	}
}
